import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/LoginView'
import Register from '@/views/RegisterView'
import Home from '@/views/HomeView'
import Detail from '@/views/DetailView'
import ArticleView from '@/views/Home/ArticleView'
import CollectView from '@/views/Home/CollectView'
import LikeView from '@/views/Home/LikeView'
import UserView from '@/views/Home/UserView'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  {
    path: '/',
    redirect: '/article',
    component: Home,
    children: [
      { path: 'article', component: ArticleView },
      { path: 'collect', component: CollectView },
      { path: 'like', component: LikeView },
      { path: 'user', component: UserView }
    ]
  },
  { path: '/detail/:id', component: Detail }
]

const router = new VueRouter({
  routes
})

export default router
